package tech.aistar.mapper.trading;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.trading.TransactionReply;
import java.util.List;

/**
 * @author Ace
 * @version 1.0
 * @descriiption:本类用来演示:二手交易回复
 * @date 2019/9/27 0027.
 */
public interface TransactionReplyMapper {

    /**
     * 查--查所有
     */

    @Select("select*from transaction_reply")
    List<TransactionReply> findAll();

    /**
     *查--根据id查
     */

    @Select("select*from transaction_reply where id=#{value}")
    TransactionReply findById(Integer id);

    /**
     *改--修改更新属性
     */
    @Update("update transaction_reply set reply_id=#{replyId},message_id=#{messageId},leave_name=#{leaveName}," +
            "content=#{content},date=#{date},praise=#{praise}")
    void update(TransactionReply transactionReply);

    /**
     * 删----通过设置status的值达到删除某个数据,不用真的删除
     * @param id
     */
    @Update("update transaction_reply set status=1 where id=#{value}")
    void delById(Integer id);

    /**
     * 添加 二手交易回复
     */
    @Insert("insert into transaction_reply(reply_id,message_id,leave_name,content,date,praise)" +
            "values(#{replyId},#{messageId},#{leaveName},#{content},#{date},#{praise})")
    void save(TransactionReply transactionReply);

}
